/**
 * Created by victor on 2016/8/23.
 */
import Vue from 'vue'
import Vuex from 'vuex'
import login from  './modules/Login'
import globalstate from  './modules/globalstate'
import plugins from './plugin'
// import createLogger from 'vuex/logger'
import createLogger from 'vuex/dist/logger'
Vue.use(Vuex)
// root state object.
// each Vuex instance is just a single state tree.


// mutations are operations that actually mutates the state.
// each mutation handler gets the entire state tree as the
// first argument, followed by additional payload arguments.
// mutations must be synchronous and can be recorded by plugins
// for debugging purposes.


// A Vuex instance is created by combining the state, the actions,
// and the mutations. Because the actions and mutations are just
// functions that do not depend on the instance itself, they can
// be easily tested or even hot-reloaded (see counter-hot example).

// 配置store,这个配置是最高级的,基本全适用,有控制台的logger.也利用了本地存储.
// 生产环境就不要createLogger了.
export default new Vuex.Store({
  modules:{
    login,
    globalstate,
  },
  plugins:process.env.NODE_ENV !== 'production' ? [createLogger(),plugins] : [plugins]

})
